<template>
  <div>
    <el-tabs v-model="activeName">

      <el-tab-pane name="first">
        <div slot="label" @click="myLeaveClick">发送的申请</div>
        <my-leave ref="myLeave"></my-leave>
      </el-tab-pane>
      
      <el-tab-pane name="second">
        <div slot="label" @click="recieveLeaveClick">接收的申请</div>
        <recieve-leave ref="recieveLeave"></recieve-leave>
      </el-tab-pane>
      
    </el-tabs>
  </div>
</template>
<script>
  import MyLeave from './module/askForLeave/send-leave'
  import RecieveLeave from './module/askForLeave/receive-leave'
  export default {
    data() {
      return {
        activeName: 'first'
      }
    },
    components: {
      MyLeave,
      RecieveLeave
    },
    activated() {
      this.myLeaveClick()
    },
    methods: {
      myLeaveClick() {
        this.$nextTick(() => {
          this.$refs.myLeave.getDataList()
        })
      },
      recieveLeaveClick() {
        this.$nextTick(() => {
          this.$refs.recieveLeave.getDataList()
        })
      }
    }
  }
</script>